import { FC } from 'react'
import io from 'socket.io-client'

const socket = io('http://localhost:3000')
console.log('socket', socket)

// 发送
socket.emit(
  'sendMsgChat',
  {
    msg: 'i miss you?',
    sendId: '612987716123e292f5e5198a',
    acceptId: '61298729b5ee0692b3967832'
  },
  (res: any) => {
    console.log('res:', res)
    if (res.code === 0) {
      console.log('后台接受数据成功')
    }
  }
)
// // 监听
// socket.on('sendMsgChat', (data: any) => {
//   console.log('后台传递的消息:', data)
// })
const SocketChat = () => {
  return <div>SocketChat</div>
}

export default SocketChat
